package com.wlanauth.dao.common;

import java.io.Serializable;
import java.util.Collection;

import org.springframework.dao.DataAccessException;
/**
 * 普通DAO接口
 * @author zz
 * @date 2012-5-8
 * @email charles.zz.life@gmail.com
 */
public interface CommonDao<T extends Serializable> {
	/**
	 * 保存
	 * @param t
	 */
	void save(T t) throws DataAccessException;
	/**
	 * 更新
	 * @param t
	 */
	void update(T t) throws DataAccessException;
	/**
	 * 根据主键删除
	 * @param key
	 */
	void deleteByKey(Serializable key) throws DataAccessException;
	/**
	 * 删除
	 * @param t
	 */
	void delete(T t) throws DataAccessException;
	/**
	 * 根据主键加载
	 * @param key
	 * @return
	 */
	T load(Serializable key) throws DataAccessException;
	/**
	 * 根据主键获取
	 * @param key
	 * @return
	 */
	T get(Serializable key) throws DataAccessException;
	/**
	 * 删除全部
	 * @param entities
	 * @throws DataAccessException
	 */
	void deleteAll(Collection<?> entities) throws DataAccessException ; 
}
